package com.itheima.demo;

import com.itheima.domain.Orders;
import com.itheima.domain.User;
import com.itheima.mapper.OrdersMapper;
import com.itheima.utils.MapperUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class Demo2 {
    public static void main(String[] args) {
        //获取Sqlsession对象
        SqlSession session = MapperUtil.getsession();
        //获取Mapper代理对象
        OrdersMapper mapper = session.getMapper(OrdersMapper.class);
        //调用接口方法
        List<Orders> list = mapper.findAll();
        /*for (Orders orders : list) {
            System.out.println("用户名称：" +orders.getUser().getUsername() +  "\t订单编号：" + orders.getNumber());
        }*/
        //释放资源
        MapperUtil.close(session);
    }
}
